package org.cdc.mre.manager;

import java.util.logging.Logger;

public class FileSizeManager {
    public static String toSizeString(long size){
        String sizeString;
        //转换为单位KB
        double sizeKB = size /1024;
        long sizeKB2 = size /1024;
        //转换为单位MB
        if (sizeKB2 / 1024 == 0){
            return sizeString =Math.round(sizeKB) + "KB";
        }
        double sizeMB = sizeKB / 1024;
        long sizeMB2 = sizeKB2 /1024;
        //转换为GB
        if (sizeMB2 / 1024 == 0){
            return sizeString = Math.round(sizeMB) + "MB";
        }
        double sizeGB = sizeMB /1024;
        return sizeString = Math.round(sizeGB) + "GB";
    }
}
